CC=g++
#wildcard, this finds all *.c file and make *.o files
objects = $(patsubst %.c,%.o,$(wildcard *.c))

ROOTFLAGS := `root-config --cflags`
ROOTLIBS := -L`root-config --libdir` -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamic

all: run

#rule for basic objects
%.o: %.c %.h
	$(CXX) -Wall -g -c $< \
	$(ROOTFLAGS) \
	$(ROOTLIBS) \
	-o $@

#analysis code
run: $(objects) run.C
	$(CXX) -O3 $(objects) CmdLine/CmdLine.o run.C \
	$(ROOTFLAGS) \
	$(ROOTLIBS) \
	-o run.exe

